<template>
	<basic-container>
		<avue-notice :data="data" :option="option" @page-change="pageChange"></avue-notice>
	</basic-container>
</template>

<script>
	import request from '@/router/axios';
	export default {
		data() {
			return {
				option: {
					props: {
						img: 'img',
						title: 'msg',
						subtitle: 'createdOn',
						tag: 'uid',
						status: 'status'
					}
				},
				data: []
			};
		},
		created() {
			this.request({
				url: '/api/BaseNotice/pages',
				params: {
					page: 1
				}
			}).then(res => {
				const data = res.data
				this.data = data.data;
				this.data.forEach(m => {
					m.img = '/img/user.png'
				})
			});
		},
		mounted() {},
		methods: {
			pageChange(page, done) {
				this.request({
					url: '/api/BaseNotice/pages',
					params: {
						page: page
					}
				}).then(res => {
					const data = res.data.data
					if (data.length == 0) {
						this.$message.warning('已无更多数据！')
					} else {
						data.forEach(m => {
							m.img = '/img/user.png'
						})
						this.data = this.data.concat(data);
					}
					done();
				});
				// setTimeout(() => {
				// 	this.$message.success('页码' + page)
				// 	this.data = this.data.concat(this.data);
				// 	done();
				// }, 1000)
			}
		}
	};
</script>

<style>
</style>
